#include "ros.h"


// 通过SN号创建ros节点
// SN号注册状态
// 返回通讯端口
void Ros::newConnect()
{
    redisContext * redisCtx = redisConnect("127.0.0.1", 6379);

    vector<string> vet;
    boost::split(vet, (*m_request)["parameter"], boost::is_any_of("="));

    redisReply * reply = (redisReply *)redisCommand(redisCtx, "set %s %d", vet[1].c_str(), 50660);
    if (reply != NULL && reply->type == REDIS_REPLY_STRING) {
        printf("%s\n", reply->str);
    }
    freeReplyObject(reply);

    string ctx = "50660";
    m_response->insertPair("Content-Length", to_string(ctx.size()));
    m_response->setContext(ctx, "200");
}


